package com.bigger.controller;

import com.bigger.dto.AddVIPDTO;
import com.bigger.dto.UserPageDTO;
import com.bigger.entity.User;
import com.bigger.result.PageResult;
import com.bigger.result.Result;
import com.bigger.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/user")
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping("/get")
    public Result<PageResult<User>> page(UserPageDTO userPageDTO){
        PageResult<User> pageResult=userService.page(userPageDTO);
        return Result.success(pageResult);
    }
    @PutMapping("/add")
    public Result<String> addVIP(@RequestBody AddVIPDTO addVIPDTO){
        userService.addVIP(addVIPDTO);
        return Result.success("添加成功");
    }
    @PutMapping("/delete")
    public Result<String> delete(Long id){
        userService.delete(id);
        return Result.success("取消成功");
    }
}
